﻿namespace Neovolve.Toolkit.Workflow.Activities
{
    using System;
    using System.Activities;
    using System.Drawing;

    /// <summary>
    /// The <see cref="GetWorkflowInstanceId"/>
    ///   class is used to obtain the instance id of the executing workflow.
    /// </summary>
    [ToolboxBitmap(typeof(GetWorkflowInstanceId), "wrench.png")]
    public sealed class GetWorkflowInstanceId : CodeActivity
    {
        /// <summary>
        /// Performs the execution of the activity.
        /// </summary>
        /// <param name="context">
        /// The execution context under which the activity executes.
        /// </param>
        protected override void Execute(CodeActivityContext context)
        {
            WorkflowInstanceId.Set(context, context.WorkflowInstanceId);
        }

        /// <summary>
        /// Gets or sets the workflow instance id.
        /// </summary>
        /// <value>
        /// The workflow instance id.
        /// </value>
        public OutArgument<Guid> WorkflowInstanceId
        {
            get;
            set;
        }
    }
}